package com.texaco.chapasFutbol.multiplayer.mensajes;

import java.util.Map;

import org.json.JSONException;

public class ShootMessage extends BaseMessage{

	private static final long serialVersionUID = -6929847534962111245L;
	long idMatch;
	long idClient;
	int idChapa;
	float x;
	float y;
	
	public ShootMessage() throws JSONException{
		super(MESSAGE_SHOOT);
	}
	
	public ShootMessage(String jsonStr) throws JSONException{
		super(MESSAGE_SHOOT, jsonStr);
	}
	
	public ShootMessage(Map<String, String> jsonMap) throws JSONException{
		super(MESSAGE_SHOOT, jsonMap);
	}
	
	@Override
	protected void preRead() {
		try {
			idMatch = getLong(FIELD_ID_MATCH);
			idClient = getLong(FIELD_ID_CLIENT);
			idChapa = getInt(FIELD_ID_CHAPA);
			x = (float) getDouble(FIELD_X);
			y = (float) getDouble(FIELD_Y);
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	@Override
	protected void preWrite() {
		try {
			put(FIELD_ID_MATCH, idMatch);
			put(FIELD_ID_CLIENT, idClient);
			put(FIELD_ID_CHAPA, idChapa);
			put(FIELD_X, x);
			put(FIELD_Y, y);
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	public long getIdMatch() {
		return idMatch;
	}

	public void setIdMatch(long idMatch) {
		this.idMatch = idMatch;
	}

	public long getIdClient() {
		return idClient;
	}

	public void setIdClient(long idClient) {
		this.idClient = idClient;
	}

	public int getIdChapa() {
		return idChapa;
	}

	public void setIdChapa(int idChapa) {
		this.idChapa = idChapa;
	}

	public float getX() {
		return x;
	}

	public void setX(float x) {
		this.x = x;
	}

	public float getY() {
		return y;
	}

	public void setY(float y) {
		this.y = y;
	}
}
